<?php
//首页
	get_header();
?>
<!-- 首页banner轮播 -->
<section class="homepage_bg">
	<?php
		$opts = get_field("index_option");
	?>
    <!--首页菜单导航-->
    <div class="project">
        <div class="tab-container">
            <div class="tab-title">
                <ul>
                    <li class="tab-li" style="background: #f64d79;"><?php echo $opts[0]['title']; ?></li>
                    <li class="tab-li" style="background: #fa86f6;"><?php echo $opts[1]['title']; ?></li>
                    <li class="tab-li" style="background: #bd88fd;"><?php echo $opts[2]['title']; ?></li>
                    <li class="tab-li" style="background: #289fff;"><?php echo $opts[3]['title']; ?></li>
                </ul>
            </div>
            <div class="tab-content">
                <a href="/special/huanyanxinfs/"><img src="/wp-content/uploads/2018/06/lanmu_06.png" alt="" id="array1"></a>
            </div>
            <div class="tab-img">
                <a href="javascript:void(0);" onclick="openZoosUrl();"><img src="/wp-content/themes/pai2016/images/liwu_03.png" id="array2"></a>
            </div>
        </div>
    </div>
    <!--首页专题-->
<?php
//多个链接字符串拼接成js数组
$linkarr = "";
//小图
$sm_imgs = "";
//大图
$imgs = "";
foreach($opts as $a => $v){
	$linkarr .= '"'.$v['link'].'",';
	$sm_imgs .= '"'.$v['sm_img'].'",';
	$imgs .= '"'.$v['img'].'",';
}
?>
<script type="text/javascript">	
// 首页菜单导航切换
//大图
var imgs = [<?php echo $imgs;?>];

//小图
var sm_img = [<?php echo $sm_imgs;?>];

//链接
var linkarr = [<?php echo $linkarr;?>];
var li = $(".tab-li");
for(var i = 0; i < li.length; i++) {
    li[i].index = i;
    li.eq(i).on("click", function() {
        var index = $(this).index();
        $("#array1").attr("src", imgs[index]);
        $("#array1").parent('a').attr("href",linkarr[index]);
        $("#array2").attr("src", sm_img[index]);
        $("#array2").parent('a').attr("href",linkarr[index]);
		
    })
}
</script>
 <?php /*?>
    <div class="special">
        <ul class="special_list">
		<?php
			//热门项目
			$hots = get_field("hot_items");
			foreach($hots as $k => $v){
		?>
			<a href="<?php echo $v['link']?$v['link']:get_field('swt_link','options');?>">
                <li>
                    <img src="<?php echo $v['img'];?>" alt="<?php echo $v['title'];?>" >
                </li>
            </a>
		<?php				
			}
		?>
        </ul>
    </div>
     <?php */?>
</section>

<!--首页案例before&after-->
<div class="homepageCase">
<?php 
	
	$cases = get_field('select_case');
	foreach($cases as $k => $v){
	?>
		
	<div class="case_item">
        <div class="case_item_left">
            <img src="<?php echo get_field("headimg",$v['case']);?>" alt="" class="headerimg">
            <p class="name"><?php echo get_field("name",$v['case']);?><br><span><?php echo get_field("qianming",$v['case']);?></span></p>
        </div>
		<a href="<?php echo get_permalink( $v['case'] ); ?>">
			<img src="<?php echo get_field("case_index_img",$v['case']);?>" alt="" class="caseimg">
		</a>
        <div class="case_project">
            <ul>
				<?php
					$qms = get_field("project_have_done",$v['case']);
					$tmparr = explode('，',$qms);
					
					foreach($tmparr as $a => $b){
				?>
						<li><?php echo $b;?></li>
				<?php
					}
				?>
            </ul>
            <div class="case_item_right">
                <img src="<?php echo get_template_directory_uri();?>/images/browse.png" alt="" class="browse">
                <p class="case_item_person"><?php echo post_views(); ?></p>
                <img src="<?php echo get_template_directory_uri();?>/images/message.png" alt="" class="message">
                <p class="case_item_person"><?php echo post_say(); ?></p>
            </div>
        </div>
    </div>	
<?php
	}

?>
</div>
</div>
<!--首页专用-->
<script src="<?php echo get_template_directory_uri();?>/js/flexible.js"></script>
<?php
  get_footer();
?>
